package framework.base;

import framework.jiekou.Adap;
import framework.jiekou.sub.AdapImpl;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

public abstract class BaseAdap extends BaseAdapter implements Adap {
	public BaseAdap() {
		super();
	}

	// /////////////////////////////////模版方法///////////////////////////////////////////////////////////////
	private Adap adap;

	@Override
	public Adap getAdap() {
		if (this.adap == null) {
			this.adap = new AdapImpl(this, getContext());
		}

		if (this.adap.getAdap() == null) {
			this.adap.setAdap(this);
		}

		return this.adap;
	}

	@Override
	public void setAdap(Adap adap) {

	}

	public void setContext(Context context) {

	}

	public int getScreenWidth() {
		return getAdap().getScreenWidth();
	}

	public int getScreenHight() {
		return getAdap().getScreenHight();
	}

	public int getDesignWidth() {
		return getAdap().getDesignWidth();
	}

	public float getDensity() {
		return getAdap().getDensity();
	}

	public void viewShowOrHidden(View view) {
		getAdap().viewShowOrHidden(view);
	}

	public boolean isVisible(View view) {
		return getAdap().isVisible(view);
	}

	public void viewVisible(View view, boolean isVisible) {
		getAdap().viewVisible(view, isVisible);
	}

	public void viewVisible(View view, int id, boolean isVisible) {
		getAdap().viewVisible(view, id, isVisible);
	}

	public void viewShow(int id, View itemView) {
		getAdap().viewShow(id, itemView);
	}

	public void viewShow(View view) {
		getAdap().viewShow(view);
	}

	public void viewGone(int id, View itemView) {
		getAdap().viewGone(id, itemView);
	}

	public void viewGone(View view) {
		getAdap().viewGone(view);
	}

	public LinearLayout findLinearLayoutById(int id, View view) {
		return getAdap().findLinearLayoutById(id, view);
	}

	public ListView findListViewById(int id, View view) {
		return getAdap().findListViewById(id, view);
	}

	public Button findButtonById(int id, View view) {
		return getAdap().findButtonById(id, view);
	}

	public ProgressBar findProgressBarById(int id, View view) {
		return getAdap().findProgressBarById(id, view);
	}

	public ImageView findImageViewById(int id, View view) {
		return getAdap().findImageViewById(id, view);
	}

	public RelativeLayout findRelativeLayoutById(int id, View view) {
		return getAdap().findRelativeLayoutById(id, view);
	}

	public TextView findTextViewById(int id, View view) {
		return getAdap().findTextViewById(id, view);
	}

	public CheckBox findCheckBoxById(int id, View view) {
		return getAdap().findCheckBoxById(id, view);
	}

	public FrameLayout findFrameLayoutById(int id, View view) {
		return getAdap().findFrameLayoutById(id, view);
	}

	public ImageButton findImageButtonById(int id, View view) {
		return getAdap().findImageButtonById(id, view);
	}

	public EditText findEditTextById(int id, View view) {
		return getAdap().findEditTextById(id, view);
	}

	public View inflate(int resourceId) {
		return getAdap().inflate(resourceId);
	}

	public void layoutSetting(ViewGroup ll) {
		getAdap().layoutSetting(ll);
	}

	public void measureView(View child) {
		getAdap().measureView(child);
	}

	public void adjustTextView(TextView tv) {
		getAdap().adjustTextView(tv);
	}

	public void setImageView(ImageView imageView, String url, int defaultId) {
		getAdap().setImageView(imageView, url, defaultId);
	}

	public int layoutAdjustSize(int getW) {
		return getAdap().layoutAdjustSize(getW);
	}

	public Float layoutAdjustSize(Float getW) {
		return getAdap().layoutAdjustSize(getW);
	}

	public int adjustSize(int ori) {
		return getAdap().adjustSize(ori);
	}

	public void log(String msg) {
		getAdap().log(msg);
	}

	public void log(Object msg) {
		getAdap().log(msg);
	}

	public void isNull(String name, Object obj) {
		getAdap().isNull(name, obj);
	}

	public void exception(Exception e) {
		getAdap().exception(e);
	}

	public void setText(TextView tv, String str) {
		getAdap().setText(tv, str);
	}

	public void setText(TextView tv, Object obj) {
		getAdap().setText(tv, obj);
	}

	@Override
	public String getString(int resID) {
		return getAdap().getString(resID);
	}

}
